package com.itheima.boject;

import java.util.Scanner;

public class ScannerDemo {
    public static void main(String[] args) {

        System.out.println("键盘录入种类");

        Scanner sc = new Scanner(System.in);
        System.out.println("输入一个整数");
        int aa = sc.nextInt();
        System.out.println("aa:" + aa);
        //可以加空格
        System.out.println("输入字符串");
        String bb = sc.next();
        System.out.println("bb:" + bb);


        System.out.println("创建字符");

        String s1 = new String();
        System.out.println(s1);

        //public String()根据符数组的内容,来创建字符串对象
        char[] chs = {'a', 'b', 'c'};
        String s2 = new String(chs);
        System.out.println(s2);

        //public String(char[]chas)根据字符数组的内容,来创建字符串对象
        String s3 = new String("12345");
        System.out.println(s3);

        //String(byte[]bytes)通过使用字节数组来构造新的String
        byte[] bys = {97, 98, 99};
        String s4 = new String(bys);
        System.out.println(s4);
        // 简单最常用
        String s5 = "666";
        System.out.println(s5);

    }
}
